#ifndef REQUESTTASK_H
#define REQUESTTASK_H

#include "precomp.h"
//#include <QNetworkProxy>
#include "global.h"

class RequestTask : public QObject
{
    Q_OBJECT
public:
    explicit RequestTask(QObject *parent = nullptr);
    ~RequestTask();

    QString m_address,m_sendMsg,m_reqParam;
    int m_port;
public slots:
    void start();

signals:
    void responseReceived(QByteArray data,QString reqParam);
    void errorOccurred(QString errorMessage);
private:
    QTcpSocket *tcpSocket;
    QByteArray m_recvBuffer;

private slots:
    void sendRequest(const QString &message);
    void handleResponse();
    void socketError(QAbstractSocket::SocketError error);
};

#endif // REQUESTTASK_H
